trigger Cald_PlanInUse on Callidus_Plan__c (before delete) {
    if(Trigger.isDelete){
        for(Callidus_Plan__c p: Trigger.old){
            for(Callidus_Plan_Assignable__c[] cpa : [Select Id from Callidus_Plan_Assignable__c where Plan__c = :p.Id])
            {
                if(cpa != null && cpa.size() > 0)      
                    p.addError('This Plan cannot be deleted as it is in use.');          
            }
        }
    }
}